Skip to content

fix(guard): waive same-turn freshness for repos with no remote (v3.8.5)#152

Merged
CryptoJones merged 1 commit into
mainfrom
fix/149-new-repo-no-remote-freshness
Jul 5, 2026
Merged

fix(guard): waive same-turn freshness for repos with no remote (v3.8.5)#152
CryptoJones merged 1 commit into
mainfrom
fix/149-new-repo-no-remote-freshness

Conversation

@CryptoJones

Copy link
Copy Markdown
Owner

Fixes #149.

Problem

Inside a brand-new git init repo with no remote, omind guard locked the agent out of its own repo. The same-turn freshness gate (repo-work-fresh-base) demanded a git fetch / git pull before any review/edit/test/commit — but a repo with no remote has nothing to fetch:

  • git fetchfatal: No remote repository specified.
  • git pull --ff-onlyThere is no tracking information for the current branch.

The two remediations the block message suggests both fail (only git fetch --all --prune incidentally exits 0 as a no-op over zero remotes), so it reads as a hard deadlock — exactly the first steps of scaffolding a new project.

Fix

A repo with zero configured remotes has no upstream to be stale against, so the freshness check is vacuous there. decide() now waives the freshness demand for a no-remote repo (repo-work-fresh-base no longer fires); the rules-note consult (repo-work-read-git-rules) is unchanged.

Detection lives in a new _repo_has_remote(repo):

  • Subprocess-free — reads <repo>/.git/config for a [remote "…"] stanza, matching the module's no-subprocess-on-the-hot-path design.
  • Conservative — returns True (keep the freshness demand) on any doubt: a .git pointer file (linked worktree / submodule, whose remotes live in the shared config), an unreadable config, or a resolution error. Freshness is waived only when we positively read the repo's own config and find zero remotes.

This makes the change a pure correctness fix for new local repos and never a loosening for a repo that has a remote.

Tests

  • test_repo_has_remote_detects_configured_remotesFalse for a fresh git init, True after git remote add, True (conservative) for a non-repo path.
  • test_new_repo_without_a_remote_does_not_demand_freshness — the rules-note consult is still required, but freshness is then waived (was repo-work-fresh-base before this change).
  • test_new_repo_with_a_remote_still_demands_freshness — a repo with a remote is unaffected: repo-work-fresh-base still fires.

Full suite green (ruff check . clean; pytest 756 passed, 1 skipped).

Version

Patch bump 3.8.4 → 3.8.5 (bug fix) across pyproject.toml, src/omind/__init__.py, uv.lock, with a CHANGELOG.md entry.

🤖 Generated with Claude Code

Proudly Made in Nebraska. Go Big Red! 🌽 https://xkcd.com/2347/

…5) (#149)

A brand-new `git init` repo has no remote, so `git fetch` (No remote repository
specified) and `git pull --ff-only` (no tracking information) both fail — yet
the same-turn freshness gate demanded one before any review/edit/test/commit,
locking the agent out of its own new repo.

A repo with zero configured remotes has no upstream to be stale against, so the
freshness check is vacuous there. `decide()` now waives it for a no-remote repo
(`repo-work-fresh-base` no longer fires); the rules-note consult is unchanged.
Detection (`_repo_has_remote`) is subprocess-free — it reads `<repo>/.git/config`
for a `[remote "…"]` stanza — and conservative: a `.git` pointer file (linked
worktree/submodule), an unreadable config, or any resolution error is treated as
has-a-remote, so freshness is only ever waived when zero remotes are positively
confirmed. A repo that has a remote is completely unaffected.

Patch bump 3.8.4 → 3.8.5; CHANGELOG entry added.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@CryptoJones CryptoJones merged commit 93c54d8 into main Jul 5, 2026
13 of 15 checks passed
@CryptoJones CryptoJones deleted the fix/149-new-repo-no-remote-freshness branch July 5, 2026 12:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

omind guard locked on new repos with no remotes because pulls / fetches are not possible

1 participant